package com.atyyc.controller;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置类
@Configuration
public class WebWvcConfig implements WebMvcConfigurer {
    //ctrl+O 找到addCorsMapping
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        // 哪些接口可以跨域/** 所有
        registry.addMapping("/**").
                allowedOrigins("http://192.168.31.22:8080").
                allowedHeaders("*").allowedMethods("*").
                maxAge(3600L);
    }
}
